<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="num1">
    <input type="text" id="num2">
    <button id="btn">提交</button>
    <script>
        // 输入两个数，控制台输出之间所有的质数
        function isPrime ( a ) {
            var count = 0 ;
            for ( var i = 1 ; i <= a ; i ++ ) {
                if ( a % i == 0 ) {
                    count ++ ;
                }
            }
            if ( count == 2 ) {
                console.log(a);
            }
        } 
        function AtoB ( a , b ) {
            for (  var j = a ; j <= b ; j ++ ) {
                isPrime(j);
            }
        }
        var num1 = document.getElementById("num1");
        var num2 = document.getElementById("num2");
        var btn = document.getElementById("btn");
        btn.onclick = function () {
            var a = parseInt(num1.value);
            var b = parseInt(num2.value);
            AtoB(a,b);
        }
    </script>
</body>
</html>